<?php

class Application_Form_Login extends Zend_Form
{

    public function init()
    {
        
        $this->setName('login');
        $this->setMethod('post');
        
        // username
        $username = new Zend_Form_Element_Text('username');
        $username->setLabel('Usuario')
                ->setRequired(true)
                ->setAttrib('maxlength', "32")
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addFilter('StringToLower')
                ->addValidator( 'NotEmpty', true, array('messages'=>'Ingrese su nombre de usuario' ) )
                ->addValidator('alnum', true, array('messages' => array('notAlnum' => 'Nombre de usuario no es válido' ) ) );
        
        
        // password
        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('Contraseña')
                ->setRequired(true)
                ->setAttrib('maxlength', "32")
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator( 'NotEmpty', true, array('messages'=>'Ingrese su contraseña' ) );
        
        // submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Ingresar');
        
        
        // add elements
        $this->addElements( array($username, $password, $submit) );
    }

}